package thread;
/**
 * Thread提供了一个静态方法sleep.
 *
 * static void sleep(long ms)
 * 该方法可以让运行这个方法的线程阻塞指定毫秒.
 */
public class SleepDemo {
    public static void main(String[] args) {
       /* System.out.println("程序开始了");
        try {
            Thread.sleep(5000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("程序结束了");*/
        int i=5;
        while (i>=0){
            System.out.println(i);
            i--;
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        System.out.println("结束");

    }
}
